package com.cqhilink.iot.jobstandardmanagement.facade.service.property;

import com.alibaba.fastjson.JSONObject;
import com.cqhilink.iot.jobstandardmanagement.facade.model.Employee;
import com.cqhilink.iot.jobstandardmanagement.facade.model.EmployeeVo;
import com.cqhilink.iot.jobstandardmanagement.facade.model.EntityPro;
import com.cqhilink.iot.jobstandardmanagement.facade.model.Ztree;

import java.util.List;
import java.util.Map;

/**
 * Created by huangxueqian on 2017/2/16/016.
 * 实体特性值服务类
 */
public interface JsmEntityPropertyService {

    /**
     * @param entityPro
     * @return
     * @throws Exception
     */
    public Map<String, Object> table(EntityPro entityPro) throws Exception;

    /**
     * @return 特性值对象
     * @param entityPro 特性值管理列表,带有特性值其他信息
     */
    public JSONObject propertyTable(EntityPro entityPro,Employee employee) throws Exception;
    /**
     * @param   propertyId 特性值Id
     * @return  特性值对象
     */
    public EntityPro selectByPrimaryKey(String propertyId) throws Exception;


    /**
     * 根据特性值ID 查询特性值以及特性值其他信息
     * @param propertyId
     * @return
     * @throws Exception
     */
    public EntityPro queryByPropertyId(String propertyId) throws Exception;

    /**
     * @param   propertyId   特性值Id或者A5和一线场站数据项
     * @param   haveProperty {true为特性值，false 为一线场站或者A5的配置项}
     * @return  组装后的特性值对象
     */
    public EntityPro queryByPropertyId(String propertyId,String haveProperty) throws Exception;


    /**
     * 根据实体id查询特性值
     *
     * @param list
     * @return
     */
    List<EntityPro> selectByEntityIds(List<String> list, String orgId);


    /**
     * 保存生产实体特性
     *
     * @param entityPros
     * @return
     */
    Map<String, Object> addEntityPro(List<EntityPro> entityPros, Employee employee) throws Exception;


    Map<String, Object> clonePro(String entityTypeId, Employee employee) throws Exception;

    /**
     *
     */
    List<EntityPro> selectEntityProListByEntityId(String entityId) throws Exception;

    /**
     * 删除生产实体特性
     *
     * @param entityPropertyId
     * @return
     */
    Map<String, Object> delEntityPropertyById(String entityPropertyId);

    /**
     * 根据orgId查询集合
     *
     * @param orgId
     * @return
     * @Author 卢曼成
     * @CreateDateTime 2017/6/6 13:59
     */
    List<Ztree> selectByOrgEntity(String orgId);


    /**
     * 保存特性值
     * @param entityPro
     */
    Integer saveProperty(EntityPro entityPro, EmployeeVo employeeVo) throws Exception;


    /**
     * @param employee 人员信息
     * @param orgId    组织机构
     * @param keyword  搜索关键字
     */
    List<Ztree> loadOrgZtreeByDevice(Employee employee,String orgId,String keyword,boolean isLoadDevice) throws Exception ;

    /**
     * 获取当前组织机构下的特性值 和 设备下的特性值 可以进行查询当前下的特性值
     * @param employee
     * @param orgId
     * @param keyword
     */
    List<Ztree> loadOrgZtreeByDeviceProperty(Employee employee,String orgId,String keyword) throws Exception ;

    /**
     * 将特性值转换成树
     */
    List<Ztree> offsetEntityPro(List<EntityPro> entityPros) throws  Exception;


}